/*
 * Model.h
 *
 *  Created on: 28 août 2014
 *      Author: Raphaël
 */

#ifndef MODEL_H_
#define MODEL_H_

#include <memory>
#include <QAbstractListModel>

class QStringList;

class Model: public QAbstractListModel
    {
    Q_OBJECT
private:
    /*-------------------------------------------------------------------
    private attributs
    -------------------------------------------------------------------*/
    std::shared_ptr<QStringList> m_ptrList;
    class ModelPrivateImplementation;
    std::shared_ptr<ModelPrivateImplementation> m_ptrPrivate;

public:
    friend ModelPrivateImplementation;
    /*-------------------------------------------------------------------
    constructor/destructor
    -------------------------------------------------------------------*/
    Model(QObject* = nullptr);
    virtual ~Model();

    /*-------------------------------------------------------------------
    public methods
    -------------------------------------------------------------------*/
    int rowCount(const QModelIndex &parent = QModelIndex()) const;
    QVariant data(const QModelIndex &index, int role) const;
    QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::EditRole) const;
    Qt::ItemFlags flags(const QModelIndex &index) const;
    bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
    bool insertRows(int position, int rows, const QModelIndex &index = QModelIndex());
    bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex());

public slots:
    void onOkClicked(bool);
    void onCancelClicked(bool);
    };

#endif /* MODEL_H_ */
